import { Component, OnInit } from '@angular/core'
import { take } from 'rxjs/operators'

import { DataService } from '@shared/services/data.service'
import { PageService } from '@shared/services/page.service'
import { IBiz } from '@shared/interfaces/biz'
import { ETabScrollStatus, EBizLevel } from '@shared/enums'

@Component({
  selector: 'app-store-detail-tab-system',
  templateUrl: './tab-system.component.html',
})
export class StoreDetailTabSystemComponent implements OnInit {
  constructor(
    private dataService: DataService,
    private pageService: PageService,
  ) {}

  bizLevel = EBizLevel.Store
  bizInfo: IBiz

  ngOnInit() {
    this.dataService.storeFull$.value$.pipe(
      take(1)
    ).subscribe(full => {
      this.bizInfo = full.store.common
    })
    this.pageService.setTabScrollStatus(ETabScrollStatus.Scroll)
  }
}
